
<style>
    #Pagination1 {
        text-align: center;
        margin-top: 14px;
    }

    .pagination span.prev,
    .pagination span.next {
        background-color: #fff;
        border: 1px solid #ddd;
    }

    .pagination1 a.next,
    .pagination1 a.prev,
    .pagination1 span.prev,
    .pagination1 span.next {
        color: #11cd95;
    }

    .pagination1 .current,
    .pagination1 a:hover {
        position: relative;
        border-color: #11cd95;
        color: #fff;
        background-color: #11cd95;
    }

    .pagination1 a,
    .pagination1 span {
        display: inline-block;
        margin-left: -1px;
        padding: 0 12px;
        border: 1px solid #ddd;
        line-height: 32px;
        font-size: 14px;
        color: #b9b9b9;
        background-color: #fff;
    }

    .pagination1 .total {
        display: inline-block;
        margin-right: 30px;
        background:#11cd95;
        color: #fff;
        border: 1px solid #ddd;
        padding: 4px 12px;
    }

</style>





<div class="admin-biaogelist">

    <div class="listbiaoti am-cf">
        <ul class="am-icon-flag on"> 京东任务排序</ul>

        <dl class="am-icon-home" style="float: right;">当前位置： 首页 > <a href="#">京东任务排序</a></dl>

        <!--<dl>
          <button type="button" class="am-btn am-btn-danger am-round am-btn-xs am-icon-plus" > 补充线订单</button>
        </dl>-->
        <!--这里打开的是新页面-->

    </div>

    <div class="fbneirong">
        <form class="am-form am-g">

            <table width="100%" class="am-table am-table-bordered am-table-radius am-table-striped am-table-hover">
                <thead>
                <tr class="am-success">
                    <th class="table-check"><input type="checkbox" /></th>

                    <th class="table-id">ID</th>
                    <th class="table-title">店铺名</th>
                    <th class="table-title">关键字</th>
                    <th class="table-title">价格</th>

                    <th class="table-title">备注</th>
                    <th class="table-type">单量</th>
                    <th class="table-type">每单数量</th>
                    <th class="table-title">SKU</th>
                    <th class="table-type" style="width: 200px;">每单间隔</th>

                    <th class="table-type"  style="width: 200px;">操作</th>
                </tr>
                </thead>
                <tbody class="impowdith1">
                </tbody>
            </table>

            <!--  <div class="am-btn-group am-btn-group-xs">
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-plus"></span> 删除</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 上架</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 下架</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 移动</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-plus"></span> 新增</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 保存</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-archive"></span> 移动</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-trash-o"></span> 删除</button>
              </div>-->



            <div id="Pagination1" style="margin:20px auto" style="display:none"></div>

            <!--  <ul class="am-pagination am-fr">


              </ul>-->






        </form>

        <hr />
        <form class="am-form am-g">

            <div class="soso" style="margin-left: 50%">
                <p class="ycfg" style="margin-left: 60px;"><input type="text" name="keyword" class="am-form-field am-input-sm" placeholder="关键词" /></p>
                <p class="ycfg" style="margin-left: 60px;"><input type="text" name="shop_name" class="am-form-field am-input-sm" placeholder="店铺名" /></p>
                <p class="" > <div   style="margin-left: 20px;" class="am-btn am-btn-secondary am-radius search">查找</div></p>
            </div>

            <table width="100%" class="am-table am-table-bordered am-table-radius am-table-striped am-table-hover">
                <thead>
                <tr class="am-success">
                    <th class="table-check"><input type="checkbox" /></th>

                    <th class="table-id">ID</th>
                    <th class="table-title">店铺名</th>
                    <th class="table-title">关键字</th>
                    <th class="table-title">价格</th>
                    <th class="table-title">备注</th>
                    <th class="table-title">剩余单量</th>
                    <th class="table-title">每单数量</th>
                    <th class="table-title">SKU</th>
                    <th class="table-type" style="width: 200px;">每单间隔</th>
                    <th class="table-type"  style="width: 200px;">操作</th>
                </tr>
                </thead>
                <tbody class="impowdith2">
                </tbody>
            </table>

            <!--  <div class="am-btn-group am-btn-group-xs">
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-plus"></span> 删除</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 上架</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 下架</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 移动</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-plus"></span> 新增</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 保存</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-archive"></span> 移动</button>
                  <button type="button" class="am-btn am-btn-default"><span class="am-icon-trash-o"></span> 删除</button>
              </div>-->



            <div id="Pagination" style="margin:20px auto" style="display:none"></div>

            <!--  <ul class="am-pagination am-fr">


              </ul>-->






        </form>
    </div>

    <script>
        $.ajaxSettings.async = false;
        var on_request=false;
        var type=1;
        var page=1;

        function config(id,value,newtype) {
            var url = "<?php echo base_url(); ?>/Customer/SetTaskInterval";
            var postdata = {
                'id': id,
                'type': newtype,
                'value':value
            };
            $.post(url, postdata, function (data) {
                alert(data.msg);
                getjdtasklist();
                getjdtasklist2();
            }, 'json');
        }

        function cancel(id){
            var url = "<?php echo base_url(); ?>/Customer/TaskCancel";
            var postdata = {
                'id': id
            };

            var result= confirm("确认废除该任务？");
            if(!result){
                return;
            }
            $.post(url, postdata, function (data) {
                alert(data.msg);
                getjdtasklist();
            }, 'json');
        }

        function Reset(id){
            var url = "<?php echo base_url(); ?>/Customer/ResetStatus";
            var postdata = {
                'id': id
            };
            var result= confirm("确认重置该任务？");
            if(!result){
                return;
            }

            $.post(url, postdata, function (data) {
                alert(data.msg);
            }, 'json');
        }


        function setlisthtnml(data) {
            var html = "";
            if (data.list.length > 0) {
                $.each(data.list, function (key, value) {
                    html = html +
                        '<tr taskid="'+value.id+'"><td><input type="checkbox" /></td>\n' +
                        '<td>' + value.id + '</td>\n' +
                        '<td>' + value.shop_name + '</td>\n' +
                        '<td ><div style="width: 450px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">' + value.keyword + '</div></td>\n' +
                        '<td>' + value.pay_price + '</td>\n' +

                        '<td>' + value.remarks + '</td>\n' +
                        '<td>' + value.number + '</td>\n' +
                        '<td>' + value.each_single + '</td>\n' +
                        '<td>' + value.sku + '</td>\n' +
                        '<td><input name="jiange"  value="' + value.interval + '"  ></td>\n' +
                        '<td>' +
                        '<div     class="am-btn am-btn-secondary am-radius config" style="width: 80px; ">设置</div>' +
                        '<div     class="am-btn am-btn-secondary am-radius cancel" style="width: 80px;  margin-left: 5px">废除</div>' +
                        '</td>\n' +
                        '</tr>';
                });
                $(".impowdith1").html(html);
                $('#Pagination1').show();

                $(".config").click(function () {
                    var id=$(this).parents("tr").attr("taskid");
                    var value=$(this).parents("tr").find("input[name='jiange']").val();
                    config(id,value,1);
                });
                $(".cancel").click(function () {
                    var id=$(this).parents("tr").attr("taskid");
                    cancel(id);
                });
            } else {
                html += '<li><div style="width:100%;text-align:center;">&nbsp暂无数据</div></li>';
                $(".impowdith1").html(html);
                $('#Pagination1').hide();
            }
        }



        getjdtasklist();
        function getjdtasklist() {
            var url = "<?php echo base_url(); ?>/Customer/getjdtasklist/1";
            var username=$("input[name='username']").val();
            var date1=$("input[name='date1']").val();
            var date2=$("input[name='date2']").val();

            var postdata = {
                'page': page,
                'epage':5,
                'username': username,
                'date2': date2,
                'status': 1,
                'date1': date1
            };
            $.post(url, postdata, function (data) {
                on_request = false;
                setlisthtnml(data);
                setPagination("Pagination1", data.count, page, data.epage, function (clickPage) {
                    page = parseInt(clickPage) + 1;
                    getjdtasklist();
                });
            }, 'json');

        }


        function setlisthtnml2(data) {
            var html = "";
            if (data.list.length > 0) {
                $.each(data.list, function (key, value) {
                    html = html +
                        '<tr taskid="'+value.id+'"><td><input type="checkbox" /></td>\n' +
                        '<td>' + value.id + '</td>\n' +
                        '<td>' + value.shop_name + '</td>\n' +
                        '<td ><div style="width: 450px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">' + value.keyword + '</div></td>\n' +
                        '<td>' + value.pay_price + '</td>\n'+
                        '<td>' + value.remarks + '</td>\n' +
                        '<td>' + value.Surplus + '</td>\n' +
                        '<td>' + value.each_single + '</td>\n' +
                        '<td>' + value.sku + '</td>\n' +
                        '<td><input name="jiange"  value="' + value.interval + '"  ></td>\n' +
                        '<td>' +
                        '<div     class=" takeout am-btn am-btn-secondary am-radius" style="width: 80px; ">取出</div>' +
                        '<div     class=" Reset am-btn am-btn-secondary am-radius" style="width: 80px; margin-left: 5px; ">重置</div>' +
                        '</td>\n' +
                        '</tr>';
                });
                $(".impowdith2").html(html);
                $('#Pagination').show();
                $(".takeout").click(function () {
                    var id=$(this).parents("tr").attr("taskid");
                    var value=0;
                    config(id,value,2);
                });

                $(".Reset").click(function () {
                    var id=$(this).parents("tr").attr("taskid");
                    Reset(id);
                });



            } else {
                html += '<li><div style="width:100%;text-align:center;">&nbsp暂无数据</div></li>';
                $(".impowdith2").html(html);
                $('#Pagination').hide();
            }
        }

        $(".search").click(function () {
            page=1;
            getjdtasklist2();
        });

        getjdtasklist2();
        function getjdtasklist2() {
            var url = "<?php echo base_url(); ?>/Customer/getjdtasklist/1";
            var shop_name=$("input[name='shop_name']").val();
            var keyword=$("input[name='keyword']").val();
            var date1=$("input[name='date1']").val();
            var date2=$("input[name='date2']").val();
            var postdata = {
                'page': page,
                'epage':5,
                'shop_name': shop_name,
                'keyword': keyword,
                'status': 2,
                'date2': date2,
                'date1': date1
            };
            $.post(url, postdata, function (data) {
                setlisthtnml2(data);
                setPagination("Pagination", data.count, page, data.epage, function (clickPage) {
                    page = parseInt(clickPage) + 1;
                    getjdtasklist2();
                });
            }, 'json');
        }
    </script>








    <div class="foods">
        <ul>
            版权所有@2015.
        </ul>
        <dl>
            <a href="" title="返回头部" class="am-icon-btn am-icon-arrow-up"></a>
        </dl>
    </div>




</div>

</div>




</div>


<!--<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>-->
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="<?php echo base_url() . 'public/business/'; ?>assets/js/polyfill/rem.min.js"></script>
<script src="<?php echo base_url() . 'public/business/'; ?>assets/js/polyfill/respond.min.js"></script>
<script src="<?php echo base_url() . 'public/business/'; ?>assets/js/amazeui.legacy.js"></script>


<!--[if (gte IE 9)|!(IE)]><!-->
<script src="<?php echo base_url() . 'public/business/'; ?>assets/js/amazeui.min.js"></script>
<!--<![endif]-->



</body>
</html>